<!DOCTYPE html><html><head><meta http-equiv="content-type" content="text/html;charset=utf-8"/>
<title>商品列表</title><meta content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport">
<link href="<?php echo http_host(); ?>/css/weixin/style.css" type="text/css" rel="stylesheet">
<script type="text/javascript" src="<?php echo http_host(); ?>/js/jquery.min.js"></script><script type="text/javascript" src="<?php echo http_host(); ?>/js/weixin/mobile.js"></script>
<meta name="keywords" content="关键词"><meta name="description" content="描述"></head><body style="background-color:#ffffff;">
<div class="classreturn loginsignup">
    <div class="ds-in-bl return"><a href="javascript:history.back(-1);"><img src="<?php echo http_host(); ?>/images/weixin/return.png" alt="返回"></a></div>
    <div class="ds-in-bl tit center"><span>商品列表</span></div>
</div>

<nav class="storenav">
    <ul class="table-cell">
        <li<?php if(!isset($_REQUEST['orderby'])){echo ' class="red"';} ?>>
            <a href="<?php $complexorder = $request_param; unset($complexorder['orderby']); echo url('goods/index').'?'.http_build_query($complexorder); ?>">
                <span class="lb">综合</span>
            </a>
        </li>
        <li<?php if(isset($_REQUEST['orderby']) && $_REQUEST['orderby']==1){echo ' class="red"';} ?>>
            <a href="<?php $saleorder = $request_param;$saleorder['orderby']=1;echo url('goods/index').'?'.http_build_query($saleorder); ?>">
                <span class="dq">销量</span>
            </a>
        </li>
        <li<?php if((isset($_REQUEST['orderby']) && ($_REQUEST['orderby']==3 || $_REQUEST['orderby']==4))){echo ' class="red"';} ?>>
            <a href="<?php $priceorder = $request_param; if(isset($_REQUEST['orderby']) && $_REQUEST['orderby']==3){ $priceorder['orderby']=4; }else{ $priceorder['orderby']=3; } echo url('goods/index').'?'.http_build_query($priceorder); ?>">
                <span class="jg">价格 </span>
                <i class="pr<?php if(isset($_REQUEST['orderby']) && $_REQUEST['orderby']==3){echo ' bpr1';}elseif(isset($_REQUEST['orderby']) && $_REQUEST['orderby']==4){echo ' bpr2';} ?>"></i>
            </a>
        </li>
    </ul><div class="cl"></div>
</nav>

<div class="floor" style="margin-top:15px;">
    <?php if($goods_list){ ?>
    <ul class="ll-list" id="goods-list">
    <?php foreach($goods_list as $k=>$v){ ?>
	<li><a href="<?php echo url('goods/detail').'?id='.$v['id']; ?>">
		<?php if($v['is_promote']>0){ ?><span class="label">限时抢购</span><?php } ?>
		<img alt="<?php echo $v['title']; ?>" src="<?php echo $v['litpic']; ?>">
		<div class="ll-list-info">
			<p class="ll-list-tit2"><?php echo $v['title']; ?></p>
			<p class="ll-list-click"><?php echo $v['click']; ?>人查看</p>
			<div class="ll-list-price"><span class="price">￥<?php echo $v['price']; ?></span> <span class="market-price">￥<?php echo $v['market_price']; ?></span></div>
		</div>
	</a></li>
    <?php } ?>
    </ul><?php }else{ ?>
    <div style="text-align:center;line-height:40px;color:#999;">暂无记录</div><?php } ?>
</div>

<script>
$(function(){
    var ajaxload  = false;
    var maxpage   = false;
    var startpage = 1;
    var totalpage = <?php echo $totalpage; ?>;
    
    var tmp_url   = window.location.href;
    msg = tmp_url.split("#");
    tmp_url = msg[0];
    
    $(window).scroll(function ()
    {
        var listheight = $('#goods-list').outerHeight(); 
        
        if ($(document).scrollTop() + $(window).height() >= listheight)
        {
            if(startpage >= totalpage)
            {
                //$("#submit_bt_one").html("已是最后一页，没有更多数据！");
                return false;
            }
            
            if(!ajaxload && !maxpage)
            {
                ajaxload = true;
                //$("#submit_bt_one").html("努力加载中...");
                var url = tmp_url;
                var nextpage = startpage+1;
                
                $.get(url,{page_ajax:1,page:nextpage},function(res)
                {
                    if(res)
                    {
                        $('#goods-list').append(res);
                        startpage++;
                        
                        if(startpage >= totalpage)
                        {
                            maxpage = true;
                            //$("#submit_bt_one").html("已是最后一页，没有更多数据！");
                        }
                        else
                        {
                            //$("#submit_bt_one").html("点击加载更多");
                        }
                        
                        ajaxload = false;
                    }
                    else
                    {
                        //$("#submit_bt_one").html("请求失败，请稍候再试！");
                        ajaxload = false;
                    }
                },'json');
            }
        }
    });
});
</script>
{include file="common/footer"/}
</body></html>